package com.piece.module.spider.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@NoArgsConstructor
@Table(name = "sp_search_rule")
@ApiModel(value = "搜索引擎规则表:sp_search_rule")
public class SearchRule implements Serializable {

    @Id
    @Column(name = "id", length = 11)
    @ApiModelProperty(value = "主键")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "name")
    @ApiModelProperty(value = "搜索引擎名称")
    private String name;

    @Column(name = "url")
    @ApiModelProperty(value = "搜索引擎地址")
    private String url;

    @Column(name = "proxy")
    @ApiModelProperty(value = "是否使用代理")
    private String proxy;

    @Column(name = "paths")
    @ApiModelProperty(value = "搜索条件表达式")
    private String paths;

    @Column(name = "title_xpath")
    @ApiModelProperty(value = "搜索结果标题表达式")
    private String titleXpath;

    @Column(name = "group_xpath")
    @ApiModelProperty(value = "搜索结果分组表达式")
    private String groupXpath;

    @Column(name = "size_xpath")
    @ApiModelProperty(value = "搜索结果大小表达式")
    private String sizeXpath;

    @Column(name = "date_xpath")
    @ApiModelProperty(value = "搜索结果日期表达式")
    private String dateXpath;

    @Column(name = "detail")
    @ApiModelProperty(value = "是否配置详情页", notes = "0=有详情页, 1=无详情页")
    private String detail;

    @Column(name = "root_xpath")
    @ApiModelProperty(value = "搜索结果磁力地址上级路径表达式")
    private String rootXpath;

    @Column(name = "magnet_xpath")
    @ApiModelProperty(value = "搜索结果磁力地址表达式")
    private String magnetXpath;

    @Column(name = "files_xpath")
    @ApiModelProperty(value = "搜索结果文件表达式")
    private String filesXpath;

    @Column(name = "access_code")
    @ApiModelProperty(value = "提取码")
    private String accessCode;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

}
